﻿#region DaAssessStandard
/*----------------------------------------------------------------
// 文件名：DaAssessStandard.cs
// 功能描述：类AssessStandard的数据访问层
//
// 
// 创建时间：2009-07-12 DtataAccess template . Ver 5.0.20090413
//
// 修改标识： 
// 修改描述： 
//----------------------------------------------------------------*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Globalization;
using System.Text;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;

using Las.Model; 


namespace Las.Dal
{
	///可以继承更上层接口,IAssessStandard ,数据访问层基类DaBase，
	///DaBase中包含了DbException异常处理静态方法
    public	partial  class DaAssessStandard:DaBase<MoAssessStandard>
    {	 
		#region SQL const
		internal const string TABLE_COLUMNS=" ASS_STD_ID ,ASS_STD_GROUP_ID ,A ,A_ROWSPAN ,A_COLSPAN ,B ,B_ROWSPAN ,B_COLSPAN ,C ,C_ROWSPAN ,C_COLSPAN ,D ,D_ROWSPAN ,D_COLSPAN ,ASS_POINT ,AP_SCORE ,BASIC_STANDARD ,IMPLEMENTATION ,REM ,ASS_TARGET ,CAL_TYPE ,CLASS1 ,CLASS2   ";
		
		internal const string SQL_INSERT="INSERT INTO LA_ASSESS_STANDARD ("+TABLE_COLUMNS+") VALUES (@AssStdId,@AssStdGroupId,@A,@ARowspan,@AColspan,@B,@BRowspan,@BColspan,@C,@CRowspan,@CColspan,@D,@DRowspan,@DColspan,@AssPoint,@ApScore,@BasicStandard,@Implementation,@Rem,@AssTarget,@CalType,@Class1,@Class2)";
		internal const string SQL_SELECT="SELECT "+TABLE_COLUMNS+" FROM LA_ASSESS_STANDARD  ";
		internal const string SQL_SELECT_ONE=SQL_SELECT+" WHERE ASS_STD_ID=@AssStdId";                              
		
		internal const string SQL_EXIST="SELECT COUNT(*) FROM LA_ASSESS_STANDARD  WHERE ASS_STD_ID=@AssStdId  ";
		internal const string SQL_UPDATE="UPDATE LA_ASSESS_STANDARD SET ASS_STD_GROUP_ID=@AssStdGroupId, A=@A, A_ROWSPAN=@ARowspan, A_COLSPAN=@AColspan, B=@B, B_ROWSPAN=@BRowspan, B_COLSPAN=@BColspan, C=@C, C_ROWSPAN=@CRowspan, C_COLSPAN=@CColspan, D=@D, D_ROWSPAN=@DRowspan, D_COLSPAN=@DColspan, ASS_POINT=@AssPoint, AP_SCORE=@ApScore, BASIC_STANDARD=@BasicStandard, IMPLEMENTATION=@Implementation, REM=@Rem, ASS_TARGET=@AssTarget, CAL_TYPE=@CalType, CLASS1=@Class1, CLASS2=@Class2 WHERE ASS_STD_ID=@AssStdId";
		
		internal const string SQL_DELETE_DEFAULT = "DELETE FROM LA_ASSESS_STANDARD ";
		internal const string SQL_DELETE="DELETE FROM LA_ASSESS_STANDARD WHERE ASS_STD_ID=@AssStdId";
		
		internal const string SQL_COUNT="SELECT COUNT(*) FROM LA_Assess_Standard ";
		#endregion
		       
		#region Constructor
	 
		/// <summary>
        /// 默认构造函数，使用配置文件中默认的数据库配置。
        /// </summary>
		public DaAssessStandard ()
		{ 
			this.db=DatabaseFactory.CreateDatabase();
		}
		/// <summary>
        /// 使用指定的databaseName数据库配置。
        /// </summary>
        /// <param name="databaseName">配置文件中数据库的配置名称。</param>
		public DaAssessStandard (string databaseName)
		{ 
            this.db = DatabaseFactory.CreateDatabase(databaseName);
		} 
		
		public DaAssessStandard (Database db)
		{ 
            this.db = db;
		} 
		
		#endregion
		
		//以下是CRUD方法，每个方法都有引入外部事务的版本

		#region 构造器模块
		
        protected override MoAssessStandard ConstructT()
        {
            return new MoAssessStandard();
        }
        #endregion
		
	    
		
		#region Add模块 Helper
		
		///build the command object.It never throw exception.
		protected override  DbCommand ConstructAddCommand(Database db)
		{
			DbCommand dbCommand = db.GetSqlStringCommand(SQL_INSERT);
			 
			db.AddInParameter(dbCommand,"AssStdId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"AssStdGroupId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"A",DbType.String);
			db.AddInParameter(dbCommand,"ARowspan",DbType.Int32);
			db.AddInParameter(dbCommand,"AColspan",DbType.Int32);
			db.AddInParameter(dbCommand,"B",DbType.Int32);
			db.AddInParameter(dbCommand,"BRowspan",DbType.Int32);
			db.AddInParameter(dbCommand,"BColspan",DbType.Int32);
			db.AddInParameter(dbCommand,"C",DbType.String);
			db.AddInParameter(dbCommand,"CRowspan",DbType.Int32);
			db.AddInParameter(dbCommand,"CColspan",DbType.Int32);
			db.AddInParameter(dbCommand,"D",DbType.Int32);
			db.AddInParameter(dbCommand,"DRowspan",DbType.Int32);
			db.AddInParameter(dbCommand,"DColspan",DbType.Int32);
			db.AddInParameter(dbCommand,"AssPoint",DbType.String);
			db.AddInParameter(dbCommand,"ApScore",DbType.Int32);
			db.AddInParameter(dbCommand,"BasicStandard",DbType.String);
			db.AddInParameter(dbCommand,"Implementation",DbType.String);
			db.AddInParameter(dbCommand,"Rem",DbType.String);
			db.AddInParameter(dbCommand,"AssTarget",DbType.Int32);
			db.AddInParameter(dbCommand,"CalType",DbType.Int32);
			db.AddInParameter(dbCommand,"Class1",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class2",DbType.AnsiString);
			return dbCommand;
		}		
		protected override DbCommand ConstructAddCommand(Database db,MoAssessStandard entity)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_INSERT);			 
			db.AddInParameter(dbCommand,"AssStdId",DbType.AnsiString,entity.AssStdId);
			db.AddInParameter(dbCommand,"AssStdGroupId",DbType.AnsiString,entity.AssStdGroupId);
			db.AddInParameter(dbCommand,"A",DbType.String,entity.A);
			db.AddInParameter(dbCommand,"ARowspan",DbType.Int32,entity.ARowspan);
			db.AddInParameter(dbCommand,"AColspan",DbType.Int32,entity.AColspan);
			db.AddInParameter(dbCommand,"B",DbType.Int32,entity.B);
			db.AddInParameter(dbCommand,"BRowspan",DbType.Int32,entity.BRowspan);
			db.AddInParameter(dbCommand,"BColspan",DbType.Int32,entity.BColspan);
			db.AddInParameter(dbCommand,"C",DbType.String,entity.C);
			db.AddInParameter(dbCommand,"CRowspan",DbType.Int32,entity.CRowspan);
			db.AddInParameter(dbCommand,"CColspan",DbType.Int32,entity.CColspan);
			db.AddInParameter(dbCommand,"D",DbType.Int32,entity.D);
			db.AddInParameter(dbCommand,"DRowspan",DbType.Int32,entity.DRowspan);
			db.AddInParameter(dbCommand,"DColspan",DbType.Int32,entity.DColspan);
			db.AddInParameter(dbCommand,"AssPoint",DbType.String,entity.AssPoint);
			db.AddInParameter(dbCommand,"ApScore",DbType.Int32,entity.ApScore);
			db.AddInParameter(dbCommand,"BasicStandard",DbType.String,entity.BasicStandard);
			db.AddInParameter(dbCommand,"Implementation",DbType.String,entity.Implementation);
			db.AddInParameter(dbCommand,"Rem",DbType.String,entity.Rem);
			db.AddInParameter(dbCommand,"AssTarget",DbType.Int32,entity.AssTarget);
			db.AddInParameter(dbCommand,"CalType",DbType.Int32,entity.CalType);
			db.AddInParameter(dbCommand,"Class1",DbType.AnsiString,entity.Class1);
			db.AddInParameter(dbCommand,"Class2",DbType.AnsiString,entity.Class2);
			return dbCommand;
		}
		
		protected override DbCommand PopulateAddCommandParameters(Database db,DbCommand addCmd,MoAssessStandard entity)
		{
			db.SetParameterValue(addCmd,"AssStdId",entity.AssStdId);
			db.SetParameterValue(addCmd,"AssStdGroupId",entity.AssStdGroupId);
			db.SetParameterValue(addCmd,"A",entity.A);
			db.SetParameterValue(addCmd,"ARowspan",entity.ARowspan);
			db.SetParameterValue(addCmd,"AColspan",entity.AColspan);
			db.SetParameterValue(addCmd,"B",entity.B);
			db.SetParameterValue(addCmd,"BRowspan",entity.BRowspan);
			db.SetParameterValue(addCmd,"BColspan",entity.BColspan);
			db.SetParameterValue(addCmd,"C",entity.C);
			db.SetParameterValue(addCmd,"CRowspan",entity.CRowspan);
			db.SetParameterValue(addCmd,"CColspan",entity.CColspan);
			db.SetParameterValue(addCmd,"D",entity.D);
			db.SetParameterValue(addCmd,"DRowspan",entity.DRowspan);
			db.SetParameterValue(addCmd,"DColspan",entity.DColspan);
			db.SetParameterValue(addCmd,"AssPoint",entity.AssPoint);
			db.SetParameterValue(addCmd,"ApScore",entity.ApScore);
			db.SetParameterValue(addCmd,"BasicStandard",entity.BasicStandard);
			db.SetParameterValue(addCmd,"Implementation",entity.Implementation);
			db.SetParameterValue(addCmd,"Rem",entity.Rem);
			db.SetParameterValue(addCmd,"AssTarget",entity.AssTarget);
			db.SetParameterValue(addCmd,"CalType",entity.CalType);
			db.SetParameterValue(addCmd,"Class1",entity.Class1);
			db.SetParameterValue(addCmd,"Class2",entity.Class2);
			return addCmd;
		}
		
		protected override DbCommand PopulateAddCommandParameters(Database db,DbCommand addCmd,DataRow row)
		{
			db.SetParameterValue(addCmd,"AssStdId",row["AssStdId"]);
			db.SetParameterValue(addCmd,"AssStdGroupId",row["AssStdGroupId"]);
			db.SetParameterValue(addCmd,"A",row["A"]);
			db.SetParameterValue(addCmd,"ARowspan",row["ARowspan"]);
			db.SetParameterValue(addCmd,"AColspan",row["AColspan"]);
			db.SetParameterValue(addCmd,"B",row["B"]);
			db.SetParameterValue(addCmd,"BRowspan",row["BRowspan"]);
			db.SetParameterValue(addCmd,"BColspan",row["BColspan"]);
			db.SetParameterValue(addCmd,"C",row["C"]);
			db.SetParameterValue(addCmd,"CRowspan",row["CRowspan"]);
			db.SetParameterValue(addCmd,"CColspan",row["CColspan"]);
			db.SetParameterValue(addCmd,"D",row["D"]);
			db.SetParameterValue(addCmd,"DRowspan",row["DRowspan"]);
			db.SetParameterValue(addCmd,"DColspan",row["DColspan"]);
			db.SetParameterValue(addCmd,"AssPoint",row["AssPoint"]);
			db.SetParameterValue(addCmd,"ApScore",row["ApScore"]);
			db.SetParameterValue(addCmd,"BasicStandard",row["BasicStandard"]);
			db.SetParameterValue(addCmd,"Implementation",row["Implementation"]);
			db.SetParameterValue(addCmd,"Rem",row["Rem"]);
			db.SetParameterValue(addCmd,"AssTarget",row["AssTarget"]);
			db.SetParameterValue(addCmd,"CalType",row["CalType"]);
			db.SetParameterValue(addCmd,"Class1",row["Class1"]);
			db.SetParameterValue(addCmd,"Class2",row["Class2"]);
			return addCmd;
		}
		
		#endregion
		    
		#region Update模块 Helper
		
		protected override DbCommand ConstructUpdateCommand(Database db)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_UPDATE);		    
			db.AddInParameter(dbCommand,"AssStdGroupId",DbType.AnsiString);
			db.AddInParameter(dbCommand,"A",DbType.String);
			db.AddInParameter(dbCommand,"ARowspan",DbType.Int32);
			db.AddInParameter(dbCommand,"AColspan",DbType.Int32);
			db.AddInParameter(dbCommand,"B",DbType.Int32);
			db.AddInParameter(dbCommand,"BRowspan",DbType.Int32);
			db.AddInParameter(dbCommand,"BColspan",DbType.Int32);
			db.AddInParameter(dbCommand,"C",DbType.String);
			db.AddInParameter(dbCommand,"CRowspan",DbType.Int32);
			db.AddInParameter(dbCommand,"CColspan",DbType.Int32);
			db.AddInParameter(dbCommand,"D",DbType.Int32);
			db.AddInParameter(dbCommand,"DRowspan",DbType.Int32);
			db.AddInParameter(dbCommand,"DColspan",DbType.Int32);
			db.AddInParameter(dbCommand,"AssPoint",DbType.String);
			db.AddInParameter(dbCommand,"ApScore",DbType.Int32);
			db.AddInParameter(dbCommand,"BasicStandard",DbType.String);
			db.AddInParameter(dbCommand,"Implementation",DbType.String);
			db.AddInParameter(dbCommand,"Rem",DbType.String);
			db.AddInParameter(dbCommand,"AssTarget",DbType.Int32);
			db.AddInParameter(dbCommand,"CalType",DbType.Int32);
			db.AddInParameter(dbCommand,"Class1",DbType.AnsiString);
			db.AddInParameter(dbCommand,"Class2",DbType.AnsiString);
			db.AddInParameter(dbCommand,"AssStdId",DbType.AnsiString);
			 
			return dbCommand;
		}
		protected override DbCommand ConstructUpdateCommand(Database db,MoAssessStandard entity)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_UPDATE);		    
			db.AddInParameter(dbCommand,"AssStdGroupId",DbType.AnsiString,entity.AssStdGroupId);
			db.AddInParameter(dbCommand,"A",DbType.String,entity.A);
			db.AddInParameter(dbCommand,"ARowspan",DbType.Int32,entity.ARowspan);
			db.AddInParameter(dbCommand,"AColspan",DbType.Int32,entity.AColspan);
			db.AddInParameter(dbCommand,"B",DbType.Int32,entity.B);
			db.AddInParameter(dbCommand,"BRowspan",DbType.Int32,entity.BRowspan);
			db.AddInParameter(dbCommand,"BColspan",DbType.Int32,entity.BColspan);
			db.AddInParameter(dbCommand,"C",DbType.String,entity.C);
			db.AddInParameter(dbCommand,"CRowspan",DbType.Int32,entity.CRowspan);
			db.AddInParameter(dbCommand,"CColspan",DbType.Int32,entity.CColspan);
			db.AddInParameter(dbCommand,"D",DbType.Int32,entity.D);
			db.AddInParameter(dbCommand,"DRowspan",DbType.Int32,entity.DRowspan);
			db.AddInParameter(dbCommand,"DColspan",DbType.Int32,entity.DColspan);
			db.AddInParameter(dbCommand,"AssPoint",DbType.String,entity.AssPoint);
			db.AddInParameter(dbCommand,"ApScore",DbType.Int32,entity.ApScore);
			db.AddInParameter(dbCommand,"BasicStandard",DbType.String,entity.BasicStandard);
			db.AddInParameter(dbCommand,"Implementation",DbType.String,entity.Implementation);
			db.AddInParameter(dbCommand,"Rem",DbType.String,entity.Rem);
			db.AddInParameter(dbCommand,"AssTarget",DbType.Int32,entity.AssTarget);
			db.AddInParameter(dbCommand,"CalType",DbType.Int32,entity.CalType);
			db.AddInParameter(dbCommand,"Class1",DbType.AnsiString,entity.Class1);
			db.AddInParameter(dbCommand,"Class2",DbType.AnsiString,entity.Class2);
			db.AddInParameter(dbCommand,"AssStdId",DbType.AnsiString,entity.AssStdId);
			 
			return dbCommand;
		}
		
		protected override DbCommand PopulateUpdateCommandParameters(Database db,DbCommand updateCmd,MoAssessStandard entity)
		{
			db.SetParameterValue(updateCmd,"AssStdGroupId",entity.AssStdGroupId);
			db.SetParameterValue(updateCmd,"A",entity.A);
			db.SetParameterValue(updateCmd,"ARowspan",entity.ARowspan);
			db.SetParameterValue(updateCmd,"AColspan",entity.AColspan);
			db.SetParameterValue(updateCmd,"B",entity.B);
			db.SetParameterValue(updateCmd,"BRowspan",entity.BRowspan);
			db.SetParameterValue(updateCmd,"BColspan",entity.BColspan);
			db.SetParameterValue(updateCmd,"C",entity.C);
			db.SetParameterValue(updateCmd,"CRowspan",entity.CRowspan);
			db.SetParameterValue(updateCmd,"CColspan",entity.CColspan);
			db.SetParameterValue(updateCmd,"D",entity.D);
			db.SetParameterValue(updateCmd,"DRowspan",entity.DRowspan);
			db.SetParameterValue(updateCmd,"DColspan",entity.DColspan);
			db.SetParameterValue(updateCmd,"AssPoint",entity.AssPoint);
			db.SetParameterValue(updateCmd,"ApScore",entity.ApScore);
			db.SetParameterValue(updateCmd,"BasicStandard",entity.BasicStandard);
			db.SetParameterValue(updateCmd,"Implementation",entity.Implementation);
			db.SetParameterValue(updateCmd,"Rem",entity.Rem);
			db.SetParameterValue(updateCmd,"AssTarget",entity.AssTarget);
			db.SetParameterValue(updateCmd,"CalType",entity.CalType);
			db.SetParameterValue(updateCmd,"Class1",entity.Class1);
			db.SetParameterValue(updateCmd,"Class2",entity.Class2);
			db.SetParameterValue(updateCmd,"AssStdId",entity.AssStdId);
			return updateCmd;
		}
		protected override DbCommand PopulateUpdateCommandParameters(Database db,DbCommand updateCmd,DataRow row)
		{
			db.SetParameterValue(updateCmd,"AssStdGroupId",row["AssStdGroupId"]);
			db.SetParameterValue(updateCmd,"A",row["A"]);
			db.SetParameterValue(updateCmd,"ARowspan",row["ARowspan"]);
			db.SetParameterValue(updateCmd,"AColspan",row["AColspan"]);
			db.SetParameterValue(updateCmd,"B",row["B"]);
			db.SetParameterValue(updateCmd,"BRowspan",row["BRowspan"]);
			db.SetParameterValue(updateCmd,"BColspan",row["BColspan"]);
			db.SetParameterValue(updateCmd,"C",row["C"]);
			db.SetParameterValue(updateCmd,"CRowspan",row["CRowspan"]);
			db.SetParameterValue(updateCmd,"CColspan",row["CColspan"]);
			db.SetParameterValue(updateCmd,"D",row["D"]);
			db.SetParameterValue(updateCmd,"DRowspan",row["DRowspan"]);
			db.SetParameterValue(updateCmd,"DColspan",row["DColspan"]);
			db.SetParameterValue(updateCmd,"AssPoint",row["AssPoint"]);
			db.SetParameterValue(updateCmd,"ApScore",row["ApScore"]);
			db.SetParameterValue(updateCmd,"BasicStandard",row["BasicStandard"]);
			db.SetParameterValue(updateCmd,"Implementation",row["Implementation"]);
			db.SetParameterValue(updateCmd,"Rem",row["Rem"]);
			db.SetParameterValue(updateCmd,"AssTarget",row["AssTarget"]);
			db.SetParameterValue(updateCmd,"CalType",row["CalType"]);
			db.SetParameterValue(updateCmd,"Class1",row["Class1"]);
			db.SetParameterValue(updateCmd,"Class2",row["Class2"]);
			db.SetParameterValue(updateCmd,"AssStdId",row["AssStdId"]);
			return updateCmd;
		}
		
		protected override void PrepareDataAdapterCommand(Database db,out DbCommand dbInsertCommand,
		                     out DbCommand dbUpdateCommand,out DbCommand dbDeleteCommand)
		{
			dbInsertCommand = db.GetSqlStringCommand(SQL_INSERT);
			#region set insert cmd parameters
			db.AddInParameter(dbInsertCommand, "AssStdId",DbType.AnsiString, "ASS_STD_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "AssStdGroupId",DbType.AnsiString, "ASS_STD_GROUP_ID", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "A",DbType.String, "A", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "ARowspan",DbType.Int32, "A_ROWSPAN", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "AColspan",DbType.Int32, "A_COLSPAN", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "B",DbType.Int32, "B", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "BRowspan",DbType.Int32, "B_ROWSPAN", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "BColspan",DbType.Int32, "B_COLSPAN", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "C",DbType.String, "C", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "CRowspan",DbType.Int32, "C_ROWSPAN", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "CColspan",DbType.Int32, "C_COLSPAN", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "D",DbType.Int32, "D", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "DRowspan",DbType.Int32, "D_ROWSPAN", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "DColspan",DbType.Int32, "D_COLSPAN", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "AssPoint",DbType.String, "ASS_POINT", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "ApScore",DbType.Int32, "AP_SCORE", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "BasicStandard",DbType.String, "BASIC_STANDARD", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Implementation",DbType.String, "IMPLEMENTATION", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Rem",DbType.String, "REM", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "AssTarget",DbType.Int32, "ASS_TARGET", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "CalType",DbType.Int32, "CAL_TYPE", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Class1",DbType.AnsiString, "CLASS1", DataRowVersion.Current);
			db.AddInParameter(dbInsertCommand, "Class2",DbType.AnsiString, "CLASS2", DataRowVersion.Current);
			#endregion
			dbUpdateCommand = db.GetSqlStringCommand(SQL_UPDATE);
			#region Set update cmd value parameters
			db.AddInParameter(dbUpdateCommand, "AssStdGroupId", DbType.AnsiString, "ASS_STD_GROUP_ID", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "A", DbType.String, "A", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "ARowspan", DbType.Int32, "A_ROWSPAN", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "AColspan", DbType.Int32, "A_COLSPAN", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "B", DbType.Int32, "B", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "BRowspan", DbType.Int32, "B_ROWSPAN", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "BColspan", DbType.Int32, "B_COLSPAN", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "C", DbType.String, "C", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "CRowspan", DbType.Int32, "C_ROWSPAN", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "CColspan", DbType.Int32, "C_COLSPAN", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "D", DbType.Int32, "D", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "DRowspan", DbType.Int32, "D_ROWSPAN", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "DColspan", DbType.Int32, "D_COLSPAN", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "AssPoint", DbType.String, "ASS_POINT", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "ApScore", DbType.Int32, "AP_SCORE", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "BasicStandard", DbType.String, "BASIC_STANDARD", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Implementation", DbType.String, "IMPLEMENTATION", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Rem", DbType.String, "REM", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "AssTarget", DbType.Int32, "ASS_TARGET", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "CalType", DbType.Int32, "CAL_TYPE", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Class1", DbType.AnsiString, "CLASS1", DataRowVersion.Current);
			db.AddInParameter(dbUpdateCommand, "Class2", DbType.AnsiString, "CLASS2", DataRowVersion.Current);
			#endregion
			#region set update cmd pk where parameters
			db.AddInParameter(dbUpdateCommand, "AssStdId", DbType.AnsiString, "ASS_STD_ID", DataRowVersion.Current);
			#endregion			
			dbDeleteCommand = db.GetSqlStringCommand(SQL_DELETE);
			#region set delete cmd pk where parameters
			db.AddInParameter(dbDeleteCommand, "AssStdId", DbType.AnsiString, "ASS_STD_ID", DataRowVersion.Current);
			#endregion
		}
		#endregion	
		
		#region Delete模块 Helper		
		
		protected override DbCommand ConstructDeleteCommand(Database db)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_DELETE);
			 
			db.AddInParameter(dbCommand,"AssStdId",DbType.AnsiString);
			 
			return dbCommand;
		}		
		protected override DbCommand ConstructDeleteCommand(Database db,MoAssessStandard entity)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_DELETE);
			 
			db.AddInParameter(dbCommand,"AssStdId",DbType.AnsiString,entity.AssStdId);
		 
			return dbCommand;
		}
		
		protected override DbCommand ConstructDeleteCommandForWhere(Database db, string where)
        {
            return db.GetSqlStringCommand(SQL_DELETE_DEFAULT + where);            
        }

        protected override DbCommand PopulateDeleteCommandParameters(Database db, DbCommand deleteCmd, MoAssessStandard entity)
        {
			db.SetParameterValue(deleteCmd,"AssStdId",entity.AssStdId);
			return deleteCmd;
        }

        protected override DbCommand PopulateDeleteCommandParameters(Database db, DbCommand deleteCmd, DataRow row)
        {
			db.SetParameterValue(deleteCmd,"AssStdId",row["AssStdId"]);
			return deleteCmd;
        }      
		
		#endregion helper
		
		#region Query模块 Helper

        protected override DbCommand ConstructQueryCommand(string condition)
        {
            return db.GetSqlStringCommand(SQL_SELECT + condition);
        }

        #endregion
		
		#region GetEntity(s)模块 Helper
        
		protected override DbCommand ConstructSelectOneCommand(Database db,MoAssessStandard entity)
		{
			DbCommand dbCommand=db.GetSqlStringCommand(SQL_SELECT_ONE);
			 
			db.AddInParameter(dbCommand,"AssStdId",DbType.AnsiString,entity.AssStdId);
			return dbCommand;
		}
		
		protected override void PopulateEntityByDataReader(IDataReader reader,ref MoAssessStandard entity)
		{
			if (!reader.IsDBNull(0)) entity.AssStdId = reader.GetString(0);
			if (!reader.IsDBNull(1)) entity.AssStdGroupId = reader.GetString(1);
			if (!reader.IsDBNull(2)) entity.A = reader.GetString(2);
			if (!reader.IsDBNull(3)) entity.ARowspan = reader.GetInt32(3);
			if (!reader.IsDBNull(4)) entity.AColspan = reader.GetInt32(4);
			if (!reader.IsDBNull(5)) entity.B = reader.GetInt32(5);
			if (!reader.IsDBNull(6)) entity.BRowspan = reader.GetInt32(6);
			if (!reader.IsDBNull(7)) entity.BColspan = reader.GetInt32(7);
			if (!reader.IsDBNull(8)) entity.C = reader.GetString(8);
			if (!reader.IsDBNull(9)) entity.CRowspan = reader.GetInt32(9);
			if (!reader.IsDBNull(10)) entity.CColspan = reader.GetInt32(10);
			if (!reader.IsDBNull(11)) entity.D = reader.GetInt32(11);
			if (!reader.IsDBNull(12)) entity.DRowspan = reader.GetInt32(12);
			if (!reader.IsDBNull(13)) entity.DColspan = reader.GetInt32(13);
			if (!reader.IsDBNull(14)) entity.AssPoint = reader.GetString(14);
			if (!reader.IsDBNull(15)) entity.ApScore = reader.GetInt32(15);
			if (!reader.IsDBNull(16)) entity.BasicStandard = reader.GetString(16);
			if (!reader.IsDBNull(17)) entity.Implementation = reader.GetString(17);
			if (!reader.IsDBNull(18)) entity.Rem = reader.GetString(18);
			if (!reader.IsDBNull(19)) entity.AssTarget = reader.GetInt32(19);
			if (!reader.IsDBNull(20)) entity.CalType = reader.GetInt32(20);
			if (!reader.IsDBNull(21)) entity.Class1 = reader.GetString(21);
			if (!reader.IsDBNull(22)) entity.Class2 = reader.GetString(22);
		}
		
		

        protected override DbCommand ConstructSelectConditionCommand(Database db, string condition)
        {
            return db.GetSqlStringCommand(SQL_SELECT + condition);
        }
		
		#endregion	
		
		#region Count模块 Helper

        protected override DbCommand ConstructCountCommand(Database db)
        {
            return db.GetSqlStringCommand(SQL_COUNT);
        }

        protected override DbCommand ConstructCountConditionCommand(Database db, string condition)
        {
            return db.GetSqlStringCommand(SQL_COUNT + condition);
        }

		#endregion
		
		#region IsExist模块 Helper

        protected override DbCommand ConstructIsExistCommand(Database db, MoAssessStandard entity)
        {
            DbCommand dbCommand = db.GetSqlStringCommand(SQL_EXIST);
			db.AddInParameter(dbCommand,"AssStdId",DbType.AnsiString,entity.AssStdId);
			return dbCommand;
        }

		#endregion

		
		
	}
}	
#endregion

